
export default (plant, actual) => {
    const colors = ['rgb(114,46,209)', 'rgb(47,84,235)', 'rgb(250,173,20)', 'rgb(245,34,45)', 'rgb(82,196,26)', 'rgb(19,194,194)', 'rgb(250,140,22)', 'rgb(24,144,255)']
    let plantData = []
    plant.forEach((item, index) => {
        plantData.push({
            name: item.name,
            start: new Date(item.start).getTime(),
            end: new Date(item.end).getTime(),
            id: 'deal-0',
            x: new Date(item.start).getTime(),
            x2: new Date(item.end).getTime(),
            y: 0,
            color: colors[index]
        })
    })
    let actualData = []
    actual.forEach((item, index) => {
        actualData.push({
            name: item.name,
            start: new Date(item.start).getTime(),
            end: new Date(item.end).getTime(),
            id: 'deal-1',
            x: new Date(item.start).getTime(),
            x2: new Date(item.end).getTime(),
            y: 1,
            color: colors[index],
        })
    })
    let series = [
        {name: '计划', data:plantData},
        {name: '实际', data:actualData}
    ]
    let option = {
        title: {
            text: ''
        },
        series,
        yAxis: {
            categories:["计划用时", "实际用时"],
            type: 'category'
        },
        xAxis: {
            currentDateIndicator: true
        },
        plotOptions: {
            series: {
                dataLabels: {
                    format: "{point.name}"
                }
            }
        },
    }
    return option
}